import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "@/assets/css/normalize.css";
import "@/assets/css/index.css";
import axios from 'axios'
Vue.config.productionTip = false;
Vue.use(ElementUI);

new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");

Vue.prototype.toArtist = function(id) {
  this.$router.push("/artistdetail?id=" + id);
};
Vue.prototype.playMusic = function(id) {
  axios({
    url: "http://localhost:3000/song/url",
    method: "get",
    params: {
      id, // id:id
    },
  }).then((res) => {
    // console.log(res)
    let url = res.data.data[0].url;
    //  console.log(this.$parent.musicUrl)
    // 设置给父组件的 播放地址
    this.musicUrl = url;
  });
};
Vue.prototype.toLyric = function(id) {
  this.$router.push("/song?id=" + id);
};